import { createRouter, createWebHistory } from 'vue-router'
// 确保导入的组件路径正确
import HomeIndex from '@/views/HomeIndex.vue'
import BusinessList from '@/views/BusinessList.vue'
import BusinessInfo from '@/views/BusinessInfo.vue'
import UserLogin from '@/views/UserLogin.vue'
import UserRegister from '@/views/UserRegister.vue'
import OrderList from '@/views/OrderList.vue'
import OnlinePayment from '@/views/OnlinePayment.vue'
import ShoppingCart from '@/views/ShoppingCart.vue'
import Profile from '@/views/ProfilePage.vue' // 确保 Profile 组件存在

const routes = [
    {
        path: '/',
        name: 'Index',
        component: HomeIndex
    },
    {
        path: '/businessList',
        name: 'BusinessList',
        component: BusinessList
    },
    {
        path: '/businessInfo',
        name: 'BusinessInfo',
        component: BusinessInfo
    },
    {
        path: '/login',
        name: 'UserLogin',
        component: UserLogin
    },
    {
        path: '/register',
        name: 'UserRegister',
        component: UserRegister
    },
    {
        path: '/orderList',
        name: 'OrderList',
        component: OrderList
    },
    {
        path: '/payment',
        name: 'Payment',
        component: OnlinePayment
    },
    {
        path: '/cart',
        name: 'Cart',
        component: ShoppingCart
    },
    {
        path: '/profile',
        name: 'Profile',
        component: Profile
    }
]

// Vue CLI 中用 process.env.BASE_URL
const router = createRouter({
    history: createWebHistory(process.env.BASE_URL),
    routes
})

export default router